<?php
class Act_banks extends CI_Controller {

	public function __construct()
	{
		parent::__construct();
		$this->load->model( 'mmaster' );
		$this->load->library('enc');
	}
	
	public function read( $id ) {
		$id = $this->enc->defog($id);
		echo json_encode( $this->mmaster->getBanks( $id ) );
	}
	
	public function delete( $type, $id ) {
		if( is_null( $id ) ) {
			echo 'ERROR: Id not provided.';
			return;
		}
		$this->mmaster->deleteBank( $type, $id );
		
		$this->session->set_flashdata('message', 'Data Bank Berhasil dihapus');
		redirect(base_url()."index.php/master/".$type);
		//echo 'Records deleted successfully';
	}
}